#include"stdafx.h"
#include "SearchProcess.h"

SearchProcess::SearchProcess(string cmdString,allTaskList *givenLists,allCommandStack *givenStacks):LogicProcess(cmdString,givenLists,givenStacks){
	needList=&allTask->getUpcomingTasks();
}
void SearchProcess::HandleProcesss(){
	
	displayList->clear();
	SearchKeyWord();
}


//Key word this case is the command string 
void SearchProcess::SearchKeyWord(){
	Task tmp;
	string line;
	
	for (int i=0;i<needList->getLength();i++){
		needList->retrieve(i+1,tmp);
		line=tmp.getContent();
		if (line.find(commandString) != string::npos)
			displayList->add(tmp);
	}
	
}